

<table id="reserve_reserveInfo_data"></table>
<script>
$(function(){
	$('#reserve_reserveInfo_data').datagrid({   
	    url:'../reserveInfoServlet',
	    queryParams:{op:"getReserveInfo"},
	    loadMsg:'数据加载中...',
	    pagination:true,
	    rownumbers:true,
	    fitColumns:true,
	  	sortName:'reid',
	  	sortOrder:'desc',
	  	remoteSort:false,
	    striped:true,
	    pageNumber:1,
	    pageSize:10, 
		pageList:[10,20,30,40,50],
	    columns:[[   
	    	{field:'reid',title:'订单编号',width:150,align:'center',sortable:true},   
	    	{field:'ainame',title:'套餐名称',width:150,align:'center',sortable:true},   
	        {field:'uname',title:'客户姓名',width:150,align:'center'},   
	        {field:'tel',title:'联系方式',width:300,align:'center'},
	        {field:'redate',title:'预定日期',width:150,align:'center'} ,
	        {field:'text3',title:'备注',width:100,align:'center',editor:{type:'text',options:{required:true}}}  
	        
	    ]],   
	    
	    toolbar: [{
			text:'删除',
			iconCls: 'icon-remove',
			handler: function(){
				//获取所有被选中的行
				var rows=$("#reserve_reserveInfo_data").datagrid("getChecked");
				if(rows.length<=0){  //说明没有选中
					$.messager.show({
						title:'温馨提示',
						msg:'请选择您要删除的数据...',
						timeout:2000,
						showType:'slide'
					});
				}else{
					$.messager.confirm('信息确认', '您确定要删除选中的信息吗？', function(r){
						if (r){
							var aids="";
							//获取所有选中的数据的id
							for(var i=0;i<rows.length-1;i++){
								aids+=rows[i].reid+",";
							}
							aids+=rows[i].reid;
							
							//向服务器发送请求
							$.post("../reserveInfoServlet?t="+new Date(),{op:"delReserveInfo",aids:aids},function(data){
								data=parseInt( $.trim(data) );
								if(data>0){
								$.messager.show({
									title:'成功提示',
									msg:'订单信息删除成功...',
									timeout:3000,
									showType:'slide'
								});
								$("#reserve_reserveInfo_data").datagrid("reload");
								}else{
									$.messager.alert('失败提示','订单信息删除失败，请稍后再试...','error');
								}
							});
						}
					});
				}
			}
	
		},'-',{
			text:'修改备注',
			iconCls: 'icon-edit',
			handler: function(){
				var rows=$("#reserve_reserveInfo_data").datagrid("getChecked");
				
				if(rows.length<=0){
					$.messager.show({
						title:'温馨提示',
						msg:'请选择您要修改的数据...',
						timeout:2000,
						showType:'slide'
					});
				}else{
					$("#activities_beizhu_update").dialog("open");
					
					$("#editor_update").val( rows[0].text3 );
					
				}
			}
		}]
	});  
})

$("#reserve_reserveInfo_data").datagrid('getPager').pagination({
	beforePageText:'第',
	afterPageText:'页 共{pages}页',
	displayMsg:'当前显示{from}-{to} 条记录 共{total} 条记录'
})




    
  //修改备注的方法
var ue3 = UE.getEditor('editor_update');

  function updatebeizhu(){
  	var text3=ue3.getContent();
  	var rows=$("#reserve_reserveInfo_data").datagrid("getChecked");
				var reid="";
				//获取所有选中的数据的id
				for(var i=0;i<rows.length-1;i++){
					reid+=rows[i].reid+",";
				}
					reid+=rows[i].reid;
	$.post("../reserveInfoServlet?t="+new Date(),{op:"updateBeizhu",text3:text3,reid:reid},function(data){
		data=parseInt( $.trim(data) );
		console.info(data);
		if(data>0){
			$.messager.show({
					title:'成功提示',
					msg:'备注信息修改成功...',
					timeout:3000,
					showType:'slide'
				});
				$("#editor_update").val("");
				
				$("#activities_beizhu_update").dialog("close"); //关闭添加对话框
				$("#reserve_reserveInfo_data").datagrid("reload");
		}else{
			$.messager.alert('失败提示','备注信息修改失败，请稍后再说...','error');
		}
	});
  }
   	    
</script>

<div id="activities_beizhu_update" class="easyui-dialog" title="修改备注" style="width:600px;height:500px;" data-options="iconCls:'icon-add',resizable:true,modal:true,closed:true">  
    <br/>  <br/> 
    	 <form action="" style="padding-left:20px;float:left;">
    			<label for="editor_update">备注：
    			<div>
    				<script id="editor_update" type="text/plain" style="width:500px;height:400px;"></script>
    			</div> <br/>
    			<a href="javascript:updatebeizhu()" class="easyui-linkbutton" data-options="iconCls:'icon-add'">保存</a>
   		</form><br/> 
</div>


